home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mgr_2 / lib / ckmgrter.c < prev    next >
C/C++ Source or Header  |  1989-01-24  |  1KB  |  45 lines

  1. /*                        Copyright (c) 1988 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: ckmgrterm.c,v 4.1 88/06/21 13:40:34 bianchi Exp $
  9.     $Source: /tmp/mgrsrc/lib/RCS/ckmgrterm.c,v $
  10. */
  11. static char    RCSid_[] = "$Source: /tmp/mgrsrc/lib/RCS/ckmgrterm.c,v $$Revision: 4.1 $";
  12.  
  13. #include    <stdio.h>
  14.  
  15.  
  16. /*    Check to see if the TERM environment variable says this is an "mgr"
  17.     terminal.
  18.     If it is not, print a message, optionally preceed by the given text,
  19.     and exit with exit code 1.
  20.     Otherwise, return.
  21.     Absence of a TERM environment variable is considered OK, so that
  22.     these commands can be run within a remote shell.
  23. */
  24.  
  25. void
  26. ckmgrterm( text )
  27. char    *text;
  28. {
  29.     char    *getenv();
  30.     char    *term;
  31.  
  32.     term = getenv( "TERM" );
  33.     /*    If TERM is defined, has a non-null value,
  34.         and TERM != mgr, complain and exit.
  35.     */
  36.     if( term  &&  *term  &&  strcmp( term, "mgr" ) ) {
  37.         if( text  &&  *text ) {
  38.             fputs( text, stderr );
  39.             fputs( ":  ", stderr );
  40.         }
  41.         fputs( "only runs on mgr terminals\n", stderr );
  42.         exit( 1 );
  43.     }
  44. }
  45.